3.234 \(\int (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=42 \[ -\frac{(a B+A b) \log (\cos (c+d x))}{d}+x (a A-b B)+\frac{b B \tan (c+d x)}{d} \]

[Out]

(a*A - b*B)*x - ((A*b + a*B)*Log[Cos[c + d*x]])/d + (b*B*Tan[c + d*x])/d

________________________________________________________________________________________

Rubi [A]  time = 0.0251823, antiderivative size = 42, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.095, Rules used = {3525, 3475} \[ -\frac{(a B+A b) \log (\cos (c+d x))}{d}+x (a A-b B)+\frac{b B \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

(a*A - b*B)*x - ((A*b + a*B)*Log[Cos[c + d*x]])/d + (b*B*Tan[c + d*x])/d

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx &=(a A-b B) x+\frac{b B \tan (c+d x)}{d}+(A b+a B) \int \tan (c+d x) \, dx\\ &=(a A-b B) x-\frac{(A b+a B) \log (\cos (c+d x))}{d}+\frac{b B \tan (c+d x)}{d}\\ \end{align*}

Mathematica [A]  time = 0.0269696, size = 59, normalized size = 1.4 \[ a A x-\frac{a B \log (\cos (c+d x))}{d}-\frac{A b \log (\cos (c+d x))}{d}-\frac{b B \tan ^{-1}(\tan (c+d x))}{d}+\frac{b B \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

a*A*x - (b*B*ArcTan[Tan[c + d*x]])/d - (A*b*Log[Cos[c + d*x]])/d - (a*B*Log[Cos[c + d*x]])/d + (b*B*Tan[c + d*
x])/d

________________________________________________________________________________________

Maple [A]  time = 0.012, size = 77, normalized size = 1.8 \begin{align*}{\frac{bB\tan \left ( dx+c \right ) }{d}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) Ab}{2\,d}}+{\frac{a\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) B}{2\,d}}+{\frac{Aa\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}}-{\frac{B\arctan \left ( \tan \left ( dx+c \right ) \right ) b}{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

b*B*tan(d*x+c)/d+1/2/d*ln(1+tan(d*x+c)^2)*A*b+1/2/d*a*ln(1+tan(d*x+c)^2)*B+1/d*a*A*arctan(tan(d*x+c))-1/d*B*ar
ctan(tan(d*x+c))*b

________________________________________________________________________________________

Maxima [A]  time = 1.47176, size = 68, normalized size = 1.62 \begin{align*} \frac{2 \, B b \tan \left (d x + c\right ) + 2 \,{\left (A a - B b\right )}{\left (d x + c\right )} +{\left (B a + A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(2*B*b*tan(d*x + c) + 2*(A*a - B*b)*(d*x + c) + (B*a + A*b)*log(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]  time = 1.97173, size = 122, normalized size = 2.9 \begin{align*} \frac{2 \,{\left (A a - B b\right )} d x + 2 \, B b \tan \left (d x + c\right ) -{\left (B a + A b\right )} \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(2*(A*a - B*b)*d*x + 2*B*b*tan(d*x + c) - (B*a + A*b)*log(1/(tan(d*x + c)^2 + 1)))/d

________________________________________________________________________________________

Sympy [A]  time = 0.215695, size = 73, normalized size = 1.74 \begin{align*} \begin{cases} A a x + \frac{A b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{B a \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - B b x + \frac{B b \tan{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (A + B \tan{\left (c \right )}\right ) \left (a + b \tan{\left (c \right )}\right ) & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

Piecewise((A*a*x + A*b*log(tan(c + d*x)**2 + 1)/(2*d) + B*a*log(tan(c + d*x)**2 + 1)/(2*d) - B*b*x + B*b*tan(c
 + d*x)/d, Ne(d, 0)), (x*(A + B*tan(c))*(a + b*tan(c)), True))

________________________________________________________________________________________

Giac [B]  time = 1.32685, size = 444, normalized size = 10.57 \begin{align*} \frac{2 \, A a d x \tan \left (d x\right ) \tan \left (c\right ) - 2 \, B b d x \tan \left (d x\right ) \tan \left (c\right ) - B a \log \left (\frac{4 \,{\left (\tan \left (c\right )^{2} + 1\right )}}{\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - A b \log \left (\frac{4 \,{\left (\tan \left (c\right )^{2} + 1\right )}}{\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 2 \, A a d x + 2 \, B b d x + B a \log \left (\frac{4 \,{\left (\tan \left (c\right )^{2} + 1\right )}}{\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1}\right ) + A b \log \left (\frac{4 \,{\left (\tan \left (c\right )^{2} + 1\right )}}{\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1}\right ) - 2 \, B b \tan \left (d x\right ) - 2 \, B b \tan \left (c\right )}{2 \,{\left (d \tan \left (d x\right ) \tan \left (c\right ) - d\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/2*(2*A*a*d*x*tan(d*x)*tan(c) - 2*B*b*d*x*tan(d*x)*tan(c) - B*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2
*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)*tan(c) - A*b*log(4*(t
an(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c)
 + 1))*tan(d*x)*tan(c) - 2*A*a*d*x + 2*B*b*d*x + B*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*
tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)) + A*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan
(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)) - 2*B*b*tan(d*x) - 2*
B*b*tan(c))/(d*tan(d*x)*tan(c) - d)